clear
root.tradingPeriod.period{1}.Attributes.startTime = '09:30:00';
root.tradingPeriod.period{1}.Attributes.endTime = '11:30:00';
root.tradingPeriod.period{2}.Attributes.startTime = '13:00:00';
root.tradingPeriod.period{2}.Attributes.endTime = '15:00:00';

struct2xml(root, 'StockTradingPeriod.xml');
tree = xml2struct('StockTradingPeriod.xml');

clear
root.tradingPeriod.period{1}.Attributes.startTime = '09:15:00';
root.tradingPeriod.period{1}.Attributes.endTime = '11:30:00';
root.tradingPeriod.period{2}.Attributes.startTime = '13:00:00';
root.tradingPeriod.period{2}.Attributes.endTime = '15:15:00';

struct2xml(root, 'IFTradingPeriod.xml');
tree = xml2struct('IFTradingPeriod.xml');

clear
root.tradingPeriod.period{1}.Attributes.startTime = '09:00:00';
root.tradingPeriod.period{1}.Attributes.endTime = '11:30:00';
root.tradingPeriod.period{2}.Attributes.startTime = '13:30:00';
root.tradingPeriod.period{2}.Attributes.endTime = '15:00:00';

struct2xml(root, 'CommodityTradingPeriod.xml');
tree = xml2struct('CommodityTradingPeriod.xml');